package com.libra.assemble.entity.email;

import com.libra.assemble.entity.IdEntity;
import com.libra.assemble.xutil.enums.Whether;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 邮件内容信息(接收的邮件).
 *
 * @author Libra
 */
@Entity
@Table(name = "tb_email_content")
public class EmailContent extends IdEntity {

    /**
     * 邮件主题
     */
    private String subject;

    /**
     * 邮件发送日期
     */
    private Date sentDate;

    /**
     * 发件人名称
     */
    private String fromName;

    /**
     * 发件人地址
     */
    private String fromAddress;

    /**
     * 收件人地址
     */
    private String mailAddressTo;

    /**
     * 抄送人地址
     */
    private String mailAddressCc;

    /**
     * 密送人地址
     */
    private String mailAddressBcc;

    /**
     * 邮件的Message-ID
     */
    private Integer messageId;

    /**
     * 邮件是否已读
     */
    private Whether hasRead;

    /**
     * 判断此邮件是否包含附件
     */
    private Whether isContainAttach;

    /**
     * 邮件附件信息
     */
    private List<EmailAttachment> attachments;


    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public Date getSentDate() {
        return sentDate;
    }

    public void setSentDate(Date sentDate) {
        this.sentDate = sentDate;
    }

    public String getFromName() {
        return fromName;
    }

    public void setFromName(String fromName) {
        this.fromName = fromName;
    }

    public String getFromAddress() {
        return fromAddress;
    }

    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress;
    }

    public String getMailAddressTo() {
        return mailAddressTo;
    }

    public void setMailAddressTo(String mailAddressTo) {
        this.mailAddressTo = mailAddressTo;
    }

    public String getMailAddressCc() {
        return mailAddressCc;
    }

    public void setMailAddressCc(String mailAddressCc) {
        this.mailAddressCc = mailAddressCc;
    }

    public String getMailAddressBcc() {
        return mailAddressBcc;
    }

    public void setMailAddressBcc(String mailAddressBcc) {
        this.mailAddressBcc = mailAddressBcc;
    }

    public Integer getMessageId() {
        return messageId;
    }

    public void setMessageId(Integer messageId) {
        this.messageId = messageId;
    }

    @Enumerated(EnumType.ORDINAL)
    public Whether getHasRead() {
        return hasRead;
    }

    public void setHasRead(Whether hasRead) {
        this.hasRead = hasRead;
    }

    @Enumerated(EnumType.ORDINAL)
    public Whether getIsContainAttach() {
        return isContainAttach;
    }

    public void setIsContainAttach(Whether isContainAttach) {
        this.isContainAttach = isContainAttach;
    }

    @OneToMany(cascade= CascadeType.ALL, mappedBy="emailContent")
    public List<EmailAttachment> getAttachments() {
        return attachments;
    }

    public void setAttachments(List<EmailAttachment> attachments) {
        this.attachments = attachments;
    }
}
